package cn.com.utt.common.message;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;

public class UploadResp extends Message {
	@JSONField(name = "status")
	private int status;
	@JSONField(name = "error")
	private Fault error;
	@JSONField(name = "filesize")
	private int fileSize;
	@JSONField(name = "md5")
	private String MD5;

	public UploadResp() {
		setType(MessageType.UPLOADRESP.toString());
	}

	@Override
	public String encode() {
		return JSON.toJSONString(this);
	}

	@Override
	public void decode(byte[] buf) {
		UploadResp uploadResp = JSON.parseObject(buf, UploadResp.class);
		this.setId(uploadResp.getId());
		this.status = uploadResp.getStatus();
		this.error = uploadResp.getError();
		this.fileSize = uploadResp.getFileSize();
		this.MD5 = uploadResp.getMD5();
	}


	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Fault getError() {
		return error;
	}

	public void setError(Fault error) {
		this.error = error;
	}

	public int getFileSize() {
		return fileSize;
	}

	public void setFileSize(int fileSize) {
		this.fileSize = fileSize;
	}

	public String getMD5() {
		return MD5;
	}

	public void setMD5(String MD5) {
		this.MD5 = MD5;
	}

	
}
